/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.caresms.model;

import com.caresms.service.Sms_MasterLocalServiceUtil;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.BaseModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.util.PortalUtil;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author cc
 */
public class Sms_MasterClp extends BaseModelImpl<Sms_Master>
	implements Sms_Master {
	public Sms_MasterClp() {
	}

	public Class<?> getModelClass() {
		return Sms_Master.class;
	}

	public String getModelClassName() {
		return Sms_Master.class.getName();
	}

	public long getPrimaryKey() {
		return _SmsId;
	}

	public void setPrimaryKey(long primaryKey) {
		setSmsId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_SmsId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("SmsId", getSmsId());
		attributes.put("companyId", getCompanyId());
		attributes.put("userId", getUserId());
		attributes.put("SmsContent", getSmsContent());
		attributes.put("createDate", getCreateDate());
		attributes.put("Approved_By", getApproved_By());
		attributes.put("isActive", getIsActive());
		attributes.put("Sms_chars_Size", getSms_chars_Size());
		attributes.put("field1", getField1());
		attributes.put("field2", getField2());
		attributes.put("field3", getField3());
		attributes.put("field4", getField4());
		attributes.put("field5", getField5());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long SmsId = (Long)attributes.get("SmsId");

		if (SmsId != null) {
			setSmsId(SmsId);
		}

		Long companyId = (Long)attributes.get("companyId");

		if (companyId != null) {
			setCompanyId(companyId);
		}

		Long userId = (Long)attributes.get("userId");

		if (userId != null) {
			setUserId(userId);
		}

		String SmsContent = (String)attributes.get("SmsContent");

		if (SmsContent != null) {
			setSmsContent(SmsContent);
		}

		Date createDate = (Date)attributes.get("createDate");

		if (createDate != null) {
			setCreateDate(createDate);
		}

		Long Approved_By = (Long)attributes.get("Approved_By");

		if (Approved_By != null) {
			setApproved_By(Approved_By);
		}

		Boolean isActive = (Boolean)attributes.get("isActive");

		if (isActive != null) {
			setIsActive(isActive);
		}

		Integer Sms_chars_Size = (Integer)attributes.get("Sms_chars_Size");

		if (Sms_chars_Size != null) {
			setSms_chars_Size(Sms_chars_Size);
		}

		String field1 = (String)attributes.get("field1");

		if (field1 != null) {
			setField1(field1);
		}

		Boolean field2 = (Boolean)attributes.get("field2");

		if (field2 != null) {
			setField2(field2);
		}

		Integer field3 = (Integer)attributes.get("field3");

		if (field3 != null) {
			setField3(field3);
		}

		Date field4 = (Date)attributes.get("field4");

		if (field4 != null) {
			setField4(field4);
		}

		String field5 = (String)attributes.get("field5");

		if (field5 != null) {
			setField5(field5);
		}
	}

	public long getSmsId() {
		return _SmsId;
	}

	public void setSmsId(long SmsId) {
		_SmsId = SmsId;
	}

	public long getCompanyId() {
		return _companyId;
	}

	public void setCompanyId(long companyId) {
		_companyId = companyId;
	}

	public long getUserId() {
		return _userId;
	}

	public void setUserId(long userId) {
		_userId = userId;
	}

	public String getUserUuid() throws SystemException {
		return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
	}

	public void setUserUuid(String userUuid) {
		_userUuid = userUuid;
	}

	public String getSmsContent() {
		return _SmsContent;
	}

	public void setSmsContent(String SmsContent) {
		_SmsContent = SmsContent;
	}

	public Date getCreateDate() {
		return _createDate;
	}

	public void setCreateDate(Date createDate) {
		_createDate = createDate;
	}

	public long getApproved_By() {
		return _Approved_By;
	}

	public void setApproved_By(long Approved_By) {
		_Approved_By = Approved_By;
	}

	public boolean getIsActive() {
		return _isActive;
	}

	public boolean isIsActive() {
		return _isActive;
	}

	public void setIsActive(boolean isActive) {
		_isActive = isActive;
	}

	public int getSms_chars_Size() {
		return _Sms_chars_Size;
	}

	public void setSms_chars_Size(int Sms_chars_Size) {
		_Sms_chars_Size = Sms_chars_Size;
	}

	public String getField1() {
		return _field1;
	}

	public void setField1(String field1) {
		_field1 = field1;
	}

	public boolean getField2() {
		return _field2;
	}

	public boolean isField2() {
		return _field2;
	}

	public void setField2(boolean field2) {
		_field2 = field2;
	}

	public int getField3() {
		return _field3;
	}

	public void setField3(int field3) {
		_field3 = field3;
	}

	public Date getField4() {
		return _field4;
	}

	public void setField4(Date field4) {
		_field4 = field4;
	}

	public String getField5() {
		return _field5;
	}

	public void setField5(String field5) {
		_field5 = field5;
	}

	public BaseModel<?> getSms_MasterRemoteModel() {
		return _sms_MasterRemoteModel;
	}

	public void setSms_MasterRemoteModel(BaseModel<?> sms_MasterRemoteModel) {
		_sms_MasterRemoteModel = sms_MasterRemoteModel;
	}

	public void persist() throws SystemException {
		if (this.isNew()) {
			Sms_MasterLocalServiceUtil.addSms_Master(this);
		}
		else {
			Sms_MasterLocalServiceUtil.updateSms_Master(this);
		}
	}

	@Override
	public Sms_Master toEscapedModel() {
		return (Sms_Master)Proxy.newProxyInstance(Sms_Master.class.getClassLoader(),
			new Class[] { Sms_Master.class }, new AutoEscapeBeanHandler(this));
	}

	@Override
	public Object clone() {
		Sms_MasterClp clone = new Sms_MasterClp();

		clone.setSmsId(getSmsId());
		clone.setCompanyId(getCompanyId());
		clone.setUserId(getUserId());
		clone.setSmsContent(getSmsContent());
		clone.setCreateDate(getCreateDate());
		clone.setApproved_By(getApproved_By());
		clone.setIsActive(getIsActive());
		clone.setSms_chars_Size(getSms_chars_Size());
		clone.setField1(getField1());
		clone.setField2(getField2());
		clone.setField3(getField3());
		clone.setField4(getField4());
		clone.setField5(getField5());

		return clone;
	}

	public int compareTo(Sms_Master sms_Master) {
		long primaryKey = sms_Master.getPrimaryKey();

		if (getPrimaryKey() < primaryKey) {
			return -1;
		}
		else if (getPrimaryKey() > primaryKey) {
			return 1;
		}
		else {
			return 0;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		Sms_MasterClp sms_Master = null;

		try {
			sms_Master = (Sms_MasterClp)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = sms_Master.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(27);

		sb.append("{SmsId=");
		sb.append(getSmsId());
		sb.append(", companyId=");
		sb.append(getCompanyId());
		sb.append(", userId=");
		sb.append(getUserId());
		sb.append(", SmsContent=");
		sb.append(getSmsContent());
		sb.append(", createDate=");
		sb.append(getCreateDate());
		sb.append(", Approved_By=");
		sb.append(getApproved_By());
		sb.append(", isActive=");
		sb.append(getIsActive());
		sb.append(", Sms_chars_Size=");
		sb.append(getSms_chars_Size());
		sb.append(", field1=");
		sb.append(getField1());
		sb.append(", field2=");
		sb.append(getField2());
		sb.append(", field3=");
		sb.append(getField3());
		sb.append(", field4=");
		sb.append(getField4());
		sb.append(", field5=");
		sb.append(getField5());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(43);

		sb.append("<model><model-name>");
		sb.append("com.caresms.model.Sms_Master");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>SmsId</column-name><column-value><![CDATA[");
		sb.append(getSmsId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>companyId</column-name><column-value><![CDATA[");
		sb.append(getCompanyId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userId</column-name><column-value><![CDATA[");
		sb.append(getUserId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>SmsContent</column-name><column-value><![CDATA[");
		sb.append(getSmsContent());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>createDate</column-name><column-value><![CDATA[");
		sb.append(getCreateDate());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>Approved_By</column-name><column-value><![CDATA[");
		sb.append(getApproved_By());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>isActive</column-name><column-value><![CDATA[");
		sb.append(getIsActive());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>Sms_chars_Size</column-name><column-value><![CDATA[");
		sb.append(getSms_chars_Size());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>field1</column-name><column-value><![CDATA[");
		sb.append(getField1());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>field2</column-name><column-value><![CDATA[");
		sb.append(getField2());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>field3</column-name><column-value><![CDATA[");
		sb.append(getField3());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>field4</column-name><column-value><![CDATA[");
		sb.append(getField4());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>field5</column-name><column-value><![CDATA[");
		sb.append(getField5());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _SmsId;
	private long _companyId;
	private long _userId;
	private String _userUuid;
	private String _SmsContent;
	private Date _createDate;
	private long _Approved_By;
	private boolean _isActive;
	private int _Sms_chars_Size;
	private String _field1;
	private boolean _field2;
	private int _field3;
	private Date _field4;
	private String _field5;
	private BaseModel<?> _sms_MasterRemoteModel;
}